/**
 * Created by yunyang on 13-10-28.
 */

var mysql = require("./DB");

/**
 * 获取文件列表
 * @param {int} uid 用户ID
 * @param {function} callback 回调方法
 */
exports.getFileList = function (uid, callback) {
    mysql.query("SELECT * FROM files WHERE uid = ?", uid, function (err, results) {
        callback(results);
    });
}
/**
 *
 * @param {int} uid 用户ID
 * @param {String} createdate 创建时间
 * @param {String} filename 文件名称
 * @param {String} path 路径
 * @param {String} type 文件类型
 * @param {String} size 文件大小
 * @param {Function} callback 回调函数
 */
exports.insertNewFile = function (fileObj, callback) {
    mysql.query("INSERT INTO files SET ?", fileObj, function (err, result) {
        callback(result);
    });
}
